﻿<UserControl x:Class="daigou.modules.Product.AddEditProductView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"                           
             xmlns:cal="http://www.codeplex.com/prism"
             mc:Ignorable="d" 
             d:DesignHeight="1500" d:DesignWidth="300" >
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />    
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="3"/>
            
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        
        <Grid.Resources>
            <Style TargetType="Label">
                <Setter Property="Padding" Value="0 0 0 0"/>               
            </Style>
        </Grid.Resources>

        <DockPanel Grid.Row="0">
            <TextBlock DockPanel.Dock="Bottom" Text="{Binding Path=GrossProfit}" FontSize="20" Grid.RowSpan="2" ></TextBlock>
            <WrapPanel DockPanel.Dock="Bottom">
            <Button Margin="5" DockPanel.Dock="Bottom" Content="加载图片" HorizontalAlignment="Stretch" Height="30"  Width="116" Background="LightYellow" Name="btn_loadImage" Click="btn_loadImage_Click" />
                <Button Margin="5"  Content="保存" VerticalAlignment="Center" Command="{Binding SaveItemCommand}"  Height="30"   Background="YellowGreen"  Width="69" />
            </WrapPanel>
               
            <Image x:Name="imgPhoto"  Margin="3" Source="{Binding DomainProduct.Photo, Converter={StaticResource PathToImageConverter}}" MinHeight="100" MinWidth="100" MaxHeight="350"  HorizontalAlignment="Center"   StretchDirection="Both"  VerticalAlignment="Top" />
        </DockPanel>

        <TextBlock  Grid.Row="0"  Text="{Binding Path=SellPrice,StringFormat={}{0}元}" VerticalAlignment="Top" FontSize="20" Margin="5"  Foreground="OrangeRed" ></TextBlock>


        <GridSplitter Background="DarkGray"  ResizeDirection="Rows" Grid.Row="1" 
                         HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                        ResizeBehavior="PreviousAndNext" />
        
        <ScrollViewer Grid.Column="0" Grid.Row="2" Margin="5">
            <StackPanel>
                <Label   Content="ID号[ID]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox  Text="{Binding Path=DomainProduct.ID, UpdateSourceTrigger=PropertyChanged}" FontSize="20"  Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="编号[Code]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox  Text="{Binding Path=DomainProduct.Code, UpdateSourceTrigger=PropertyChanged}" FontSize="20"  Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="品牌[Brand]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox  Text="{Binding Path=DomainProduct.Brand, UpdateSourceTrigger=PropertyChanged}" FontSize="20"  Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="分类[Catagory]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox  Text="{Binding Path=DomainProduct.Catagory, UpdateSourceTrigger=PropertyChanged}" FontSize="20"  Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="名称[Name]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox  Text="{Binding Path=DomainProduct.Name, UpdateSourceTrigger=PropertyChanged}" FontSize="20"  Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="标签[TagList]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox  Text="{Binding Path=DomainProduct.TagList, UpdateSourceTrigger=PropertyChanged}" FontSize="20"  Style="{StaticResource TB_NoBorder}"></TextBox>


                <Label   Content="备注[Remark]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox  Text="{Binding Path=DomainProduct.Remark, UpdateSourceTrigger=PropertyChanged}"
                          AcceptsReturn="True" AcceptsTab="True" AutoWordSelection="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible"
                          FontSize="15" MinHeight="80" Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="适用人群[ApplicableCrowd]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox  Text="{Binding Path=DomainProduct.ApplicableCrowd, UpdateSourceTrigger=PropertyChanged}" FontSize="20"  Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="规格[Spec]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox  Text="{Binding Path=DomainProduct.Spec, UpdateSourceTrigger=PropertyChanged}" FontSize="20"  Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="毛重[GrossWeight]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox  Text="{Binding Path=DomainProduct.GrossWeight, UpdateSourceTrigger=PropertyChanged}" FontSize="20"   Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="进价[ImportPrice]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox   Text="{Binding Path=DomainProduct.ImportPrice, UpdateSourceTrigger=PropertyChanged}" FontSize="20"   Style="{StaticResource TB_NoBorder}"></TextBox>


                <Label   Content="百分比服务费率[ServiceRate]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox   Text="{Binding Path=DomainProduct.ServiceRate, UpdateSourceTrigger=PropertyChanged}" FontSize="20"   Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="固定服务附加费[ServiceStaticCost]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox   Text="{Binding Path=DomainProduct.ServiceStaticCost, UpdateSourceTrigger=PropertyChanged}" FontSize="20"   Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="商品包装费[PackingCost]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox   Text="{Binding Path=DomainProduct.PackingCost, UpdateSourceTrigger=PropertyChanged}" FontSize="20"   Style="{StaticResource TB_NoBorder}"></TextBox>

                <Label   Content="调整[PriceAdaption]" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox   Text="{Binding Path=DomainProduct.PriceAdaption, UpdateSourceTrigger=PropertyChanged}" FontSize="20"   Style="{StaticResource TB_NoBorder}"></TextBox>


                <WrapPanel Margin="0 20 0 0">                    
                    <Button Content="保存" VerticalAlignment="Center" Command="{Binding SaveItemCommand}"  Height="30"  Margin="5" Background="YellowGreen" MinWidth="150"/>
                    <Button Content="删除" VerticalAlignment="Center" Command="{Binding DeleteCommand}" Height="30" Margin="5" Background="RosyBrown" MinWidth="50"/>
                </WrapPanel>
            </StackPanel>
            </ScrollViewer>
    </Grid>
</UserControl>
